<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="../../static/css/style.css"/>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">

    <link href="../static/css/bootstrap_5.min.css" rel="stylesheet">
    <link href="../static/font/bootstrap-icons.css" rel="stylesheet">
    <link href="../static/css/index.css" rel="stylesheet">
    <script src="../static/js/jquery-1.11.2.min.js"></script>
</head>
<body>
<div th:fragment="nav">
<main>
    <nav class="navbar navbar-light bg-primary" style="margin: 0">
        <div class="container-fluid">
            <a href="/" class="d-flex align-items-center navbar-brand">
                <img style="border-radius: 10px" src="https://img2.baidu.com/it/u=1848128876,389693158&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" alt="" width="30" height="30" class="d-inline-block align-text-top">
                <span class="fs-4"><span style="font-size: 25px">首页</span></span>
            </a>
            <a id="showTime" style="font-size: 20px" class="nav-link px-2 text-white">时间</a>
            <script>
                var t = null;
                t = setTimeout(time,1000);//開始运行
                function time()
                {
                    clearTimeout(t);//清除定时器
                    dt = new Date();
                    var y=dt.getFullYear();
                    var mt=dt.getMonth()+1;
                    var day=dt.getDate();
                    var h=dt.getHours();//获取时
                    var m=dt.getMinutes();//获取分
                    var s=dt.getSeconds();//获取秒
                    document.getElementById("showTime").innerHTML = y+"年"+mt+"月"+day+"-"+h+"时"+m+"分"+s+"秒";
                    t = setTimeout(time,1000); //设定定时器，循环运行
                }

            </script>
            <a>
                <div class="dropdown text-end">
                    <a href="/login" onclick="login()" th:if="${user}==null" class="d-block link-dark text-decoration-none " id="dropdownUser1" data-bs-toggle="dropdown" aria-expanded="false">
                        <img src="/img/touxiang.png" alt="mdo" width="40" height="40" class="rounded-circle">
                    </a>
                    <a href="#" th:if="${user}!=null" class="d-block link-dark text-decoration-none " id="dropdownUser2" data-bs-toggle="dropdown" aria-expanded="false">
                        <img th:src="${user.user_headurl}" alt="mdo" width="40" height="40" class="rounded-circle">
                    </a>
                    <ul class="dropdown-menu text-small" aria-labelledby="dropdownUser2">
                        <li><a class="dropdown-item hover" onclick="logout()">退出</a></li>
                    </ul>
                </div>
            </a>
        </div>
    </nav>
    <script>
        function login() {
            var url = "http://localhost:8084/login";
            var a = document.createElement("a");
            a.href = url;
            a.click();
        }
        function logout() {
            $.ajax({
                type:"get",
                url:"http://localhost:8084/logout",
                success:function (data) {
                    alert(data.msg)
                    window.location.href = "http://localhost:8084/login";
                }
            })
        }
    </script>
    <header class="p-3 bg-success text-white" style="margin-top: 0">
        <div class="container">
            <div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
                <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
                    <li style="margin-left: 5px;"><a href="/mypage" class="nav-link px-2 text-white front btn-success">我的音乐</a></li>
                    <li style="margin-left: 5px;"><a href="/musicrank" class="nav-link px-2 text-white front btn-success">音乐榜单</a></li>
                    <li style="margin-left: 5px;"><a href="/musicsinger" class="nav-link px-2 text-white front btn-success">歌手</a></li>
                </ul>

                <div class="text-end">
                    <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
                        <li style="margin-left: 5px"><span class="btn-success nav-link px-2 text-white front" onclick="ifloginCreatMusicList('musiclistCreat')">创建歌单</span></li>
                        <li style="margin-left: 5px"><span class="btn-success nav-link px-2 text-white front" onclick="iflogin('musicupload')">发布音乐</span></li>
                        <li style="margin-left: 5px"><a class="nav-link px-2 text-white front btn-success" href="/visual">分析数据</a></li>
                    </ul>
                    <!--<button type="button" class="btn btn-outline-light me-2">Login</button>-->
                    <!--<button type="button" class="btn btn-warning">Sign-up</button>-->
                </div>
            </div>
        </div>
    </header>
</main>
</div>

</body>
<script src="../static/js/bootstrap.bundle.min.js"></script>
<!--<script src="../../static/js/bootstrap.min.js"></script>-->
</html>